package ec_si_template;

import java.util.Comparator;

/**
 * Compare and sort an array of individuals wrt fitness value 
 * @author Andreas Janecek 
 *
 */
public class ComparatorByBestFitness implements Comparator<Individual>{

	@Override
	/**
	 * Compare and sort an array of individuals wrt fitness value 
	 */
	public int compare(Individual o1, Individual o2) {
		if (o1.getfitness()<o2.getfitness()) return -1;
		if (o1.getfitness()>o2.getfitness()) return 1;
		return 0;
	}

}
